﻿using SmallERP.PinBan;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Small.PinBan.FrmControl
{
    public partial class frmSelectPrintName : Form
    {
        public frmSelectPrintName()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmSelectPrintName_Load(object sender, EventArgs e)
        {
            InitprinterComboBox();
            if (!string.IsNullOrEmpty(PBDataTransfer.PrintName))
            {
                com_PrintName.Text = PBDataTransfer.PrintName;
            }
            else
            {
                com_PrintName.SelectedIndex = 0;
            }
        }

        /// <summary>
        /// 加载打印机列表
        /// </summary>
        private void InitprinterComboBox()
        {
            List<String> list = LocalPrinter.GetLocalPrinters(); //获得系统中的打印机列表
            foreach (String s in list)
            {
                com_PrintName.Properties.Items.Add(s); //将打印机名称添加到下拉框中               
            }
        }

        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void But_Confim_Click(object sender, EventArgs e)
        {
            PBDataTransfer.PrintName = com_PrintName.Text;
            lbl_Mess.Text = "成功";
        }
    }
}
